require("@nomiclabs/hardhat-waffle")
require("@nomiclabs/hardhat-etherscan")
require("hardhat-deploy")
require("solidity-coverage")
require("hardhat-gas-reporter")
require("hardhat-contract-sizer")
require("dotenv").config()
require("solhint")

/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
    solidity: {
        compilers: [
            {
                version: "0.8.7",
            },
            {
                version: "0.6.6",
            },
        ],
        settings: {
            optimizer: {
                enabled: true,
                runs: 200,
            },
        },
    },
    namedAccounts: {
        deployer: {
            default: 0,
        },
        player: {
            default: 1,
        },
    },
    networks: {
        hardhat: {
            //forking 配置可以允许使用真实主网上的区块数据,hardhat将会从你提供的api上下载一部分主网的区块数据供本地测试
            //所以可以通过地址和abi直接访问主网上的合约,不需要本地mock数据
            // forking: {
            //     url: process.env.MAINNET_FORK_URL,
            // },
            chainId: 31337,
            blockConfirmations: 1,
        },

        Goerli: {
            url: process.env.Goerli_RPC_URL || "",
            accounts:
                process.env.Goerli_PRIVATE_KEY !== undefined
                    ? [process.env.Goerli_PRIVATE_KEY]
                    : [""],
            chainId: 5,
            blockConfirmations: 2,
        },
        //必须hardhat node 之后才能使用
        localhost: {
            url: "http://127.0.0.1:8545",
            chainId: 31337,
            blockConfirmations: 1,
        },
        gangache: {
            url: "http://127.0.0.1:7545",
            chainId: 5777,
            accounts: [
                "3f7b9c698b0495f0cf87f18771843a1862607bc39b72f52c19b48939c2a05cd3",
            ],
            blockConfirmations: 1,
        },
    },
    //合约部署以及操作合约所消费的gas报告
    gasReporter: {
        enabled: false,
        noColors: true,
        outputFile: "gas-report.txt",
        currency: "USD",
        // coinmarketcap: process.env.COINMARKET_API_KEY,
        token: "ETH",
    },
    etherscan: {
        apiKey: process.env.ETHERSCAN_API_KEY,
    },
    mocha: {
        timeout: 3600300, //测试超时时间30秒
    },
}
